Ladder diagram motor control